﻿
Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
        'verificacion de usuario y redireccionamiento
        'llamar el data context
        Dim db As New bdSeguridadDataContext
        'hacer la consulta
        Dim usaurio = From u In db.Web_Usuarios
                      Select u
                      Where u.Usuario = Login1.UserName And
                      u.Clave = Login1.Password And u.Activo = True

        If usaurio.Count = 1 Then
            e.Authenticated = True
            FormsAuthentication.RedirectFromLoginPage(usaurio.First.IdUsurio, True)
        Else
            e.Authenticated = False
        End If
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub
End Class
